package imp.haemers.data.vo 
{
	import flash.utils.Dictionary;
	/**
	 * ...
	 * @author Jonathan
	 */
	[Serialize(name="book")]
	public class Book
	{
		public var title:String;
		
		private var _isbn:Number;
		private var _hasAward:Boolean;
		private var _author:Author;
		private var _subAuthor:Author;
		private var _libraries:Array;
		private var _translations:Dictionary;
		private var _publishers:Array = new Array();
		
		private var _badPublishers:Vector.<Publisher>;
		private var _goodPublishers:Dictionary;
		
		private var _goodPubs:Array;
		
		public function Book() 
		{			
			_goodPublishers = new Dictionary();
		}
		
		/** Public methods **/
		[Serialize(params="isbn,won_an_award")]
		public function setBookDetails(isbn:Number, hasAward:Boolean = false) : void
		{
			_isbn = isbn;
			_hasAward = hasAward;
		}
		
		[Serialize(params="publisher", overwriteable="true")]
		public function addPublisher(publisher:Publisher):void
		{
			_publishers.push(publisher);
		}
		
		[Serialize(params="location,good_publishers")]
		public function setGoodPublishers(location:String, publishers:Vector.<Publisher>) : void
		{
			_goodPublishers[location] = publishers;
		}
		
		[Serialize(params="title,subwriter")]
		public function setSubAuthor(title:String, subAuthor:Author):void
		{
			trace("Subwriter wrote: " + title);
			_subAuthor = subAuthor;
		}
		/** Getters & Setters **/
		[Serialize(name="writer")]
		public function get author() : Author
		{
			return _author;
		}
		public function set author(value:Author) : void 
		{
			_author = value;
		}
		
		public function get subAuthor() : Author
		{
			return _subAuthor;
		}
		
		public function get isbn() : Number
		{
			return _isbn;
		}
		public function get hasAward() : Boolean
		{
			return _hasAward;
		}
		
		public function get libraries() : Array
		{
			return _libraries;
		}
		public function set libraries(value:Array) : void 
		{
			_libraries = value;
		}
		
		public function get publishers() : Array
		{
			return _publishers;
		}
		
		[Serialize(name="bad_publishers", ignore="true")]
		public function get badPublishers() : Vector.<Publisher>
		{
			return _badPublishers;
		}
		public function set badPublishers(value:Vector.<Publisher>) : void 
		{
			_badPublishers = value;
		}
		
		public function get goodPublishers() : Dictionary
		{
			return _goodPublishers;
		}
		
		public function get goodPubs() : Array
		{
			return _goodPubs;
		}
		
		[Serialize(name="translated")]
		public function get translations() : Dictionary
		{
			return _translations;
		}
		public function set translations(value:Dictionary) : void 
		{
			_translations = value;
		}
		
		/** Protected methods **/
		
		/** Private methods **/
	}

}